﻿<phone:PhoneApplicationPage 
    x:Class="Locima.SlidingBlock.GameEnd"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:converters="clr-namespace:Locima.SlidingBlock.Converters" x:Name="MainWindow"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True"
    Style="{StaticResource TransitionPageStyle}">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <phone:PhoneApplicationPage.Resources>
        <converters:ElapsedTimeConverter x:Key="ElapsedTimeConverter" />
    </phone:PhoneApplicationPage.Resources>
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="{Binding Path=Strings.ApplicationName, Source={StaticResource Localization}}" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="{Binding Path=Strings.EndGameTitle, Source={StaticResource Localization}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>

            <TextBlock x:Name="EndGameMessage"
                       Grid.Row="0" Grid.Column="0" TextWrapping="Wrap"
                       Style="{StaticResource PhoneTextNormalStyle}"/>

            <ListBox Grid.Column="0" Grid.Row="1"  Margin="12,12,12,12"
                     DataContext="{Binding ElementName=MainWindow}" ItemsSource="{Binding LevelStats}">
                <ListBox.ItemTemplate>
                <DataTemplate>
                        <Grid Grid.Row="1" Grid.Column="0" Margin="12,12,12,12">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="auto"/>
                            </Grid.RowDefinitions>
                            <TextBlock Text="{Binding Path=Strings.LevelLabel, Source={StaticResource Localization}}" Style="{StaticResource PhoneTextNormalStyle}" Grid.Row="0" Grid.Column="1"/>
                            <TextBlock Text="{Binding Index}" Style="{StaticResource PhoneTextNormalStyle}" Grid.Row="0" Grid.Column="2"/>
                            <TextBlock Text="{Binding Path=Strings.MovesLabel, Source={StaticResource Localization}}" Style="{StaticResource PhoneTextNormalStyle}" Grid.Row="1" Grid.Column="1"/>
                            <TextBlock Text="{Binding MoveCount}" Style="{StaticResource PhoneTextNormalStyle}" Grid.Row="1" Grid.Column="2"/>
                            <TextBlock Text="{Binding Path=Strings.TimeLabel, Source={StaticResource Localization}}" Style="{StaticResource PhoneTextNormalStyle}" Grid.Row="2" Grid.Column="1"/>
                            <TextBlock Text="{Binding ElapsedTime, Converter={StaticResource ElapsedTimeConverter}}" Style="{StaticResource PhoneTextNormalStyle}" Grid.Row="2" Grid.Column="2"/>
                            <Image Source="{Binding Thumbnail}" HorizontalAlignment="Left" Height="64" Width="64" Grid.Row="0" Grid.Column="0" Grid.RowSpan="3"/>
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

            <Grid Grid.Column="0" Grid.Row="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Button Content="{Binding Path=Strings.HighScorePageTitle, Source={StaticResource Localization}}" Grid.Column="0" Click="HighScoreButtonClick" />
                <Button Content="{Binding Path=Strings.MainMenu, Source={StaticResource Localization}}" Grid.Column="1" Click="MenuMenuButtonClick" />
            </Grid>
        </Grid>
    </Grid>
 
</phone:PhoneApplicationPage>

   
    